package com.tianji.remark.task;

import com.tianji.remark.domain.po.LikedRecord;
import com.tianji.remark.service.ILikedRecordService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @description
 * @author: ZXX-挚爱
 * @time: 2023/7/30 19:50
 */
@Component
@RequiredArgsConstructor
@Slf4j
public class LikedTimesCheckTask {

    private static final List<String> BIZ_TYPES=List.of("QA","NOTE");
    private static final int MAX_BIZ_SIZE=50;
    private final ILikedRecordService recordService;
    @Scheduled(fixedDelay = 20000)
    public void checkLikedTimes(){
        //log.info("开启定时任务");
        for (String bizType : BIZ_TYPES) {
            recordService.readLikedTimesAndSendMessage(bizType,MAX_BIZ_SIZE);
        }
    }
}
